Various embodiments of this disclosure relate to serialization and, more particularly, to conditional serialization for reducing unnecessary repetition of work.
In a multi-tasking computing environment, serialization is a technique that enables various threads to access shared resources while preventing corruption of those resources through simultaneous access. Serialization can be performed through the use of, for example, locks, latches, and enqueues (ENQs), which can enable a thread to maintain exclusive access in some form. After exclusive access to a resource is granted to a particular thread, the desired work can be performed without other threads corrupting the resource.
A side effect of serialization is that, in some instances, multiple threads may request that the same work be performed related to a particular resource. Due to the serialization, this work is then performed repeatedly in a single-threaded manner, as each thread gains its exclusive access and then proceeds to perform its work. As a result, the computing environment may expend more effort than necessary to perform the work requested by the various threads desiring access to the resource.
For example, several threads may wish to access a telephone directory. For some types of access, such as writing or creating, exclusive access may be desired so as to prevent data corruption. Thus, each thread must assure that the telephone directory has actually be created, and must then gain exclusive access to that directory, preventing other threads from attempting access for the purposes of reading, creating, or updating the directory until the exclusive access is complete.